import { Component, OnInit } from '@angular/core';
import { User } from 'src/app/user';
import { NgForm } from '@angular/forms';
import { RouteService } from '../route.service';
import { ShareService } from 'src/app/share/share.service';

@Component({
  selector: 'app-testa',
  templateUrl: './testa.component.html',
  styleUrls: ['./testa.component.css']
})
export class TestaComponent implements OnInit {

  user: User = new User();
  submitResult: string;
  constructor(private routeService: RouteService,
    private shareService: ShareService) { 
      shareService.test()
    }

  ngOnInit() {
    this.routeService.getUsers().subscribe(users => console.log(`testa get ${users.length} users`));
  }
  onSubmit(ngForm: NgForm): void {
    this.submitResult = JSON.stringify(ngForm.form.value);
  }
}
